#include "AdditionBondInfo.h"

#include <core/Utility.h>
#include <string.h>

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#ifdef _DEBUG
// #define	new	DEBUG_NEW
#endif

CAdditionBondInfo::CAdditionBondInfo() {
  m_nNoAddIssue = 0;
  memset(m_sAddDistDateStart, 0, sizeof(m_sAddDistDateStart));
  memset(m_sAddDistDateEnd, 0, sizeof(m_sAddDistDateEnd));
  m_fAddIssueCommissionRate = 0;
  m_fAddIssuePrice = 0;
  memset(m_sAnnStatus, 0, sizeof(m_sAnnStatus));
  memset(m_sFirstIssueKey, 0, sizeof(m_sFirstIssueKey));
  memset(m_sFirstIssueID, 0, sizeof(m_sFirstIssueID));
  memset(m_sBidOutcome, 0, sizeof(m_sBidOutcome));
  m_sReason = "";
}

CAdditionBondInfo::CAdditionBondInfo(const CAdditionBondInfo& one) {
  Clear();
  m_nNoAddIssue = one.m_nNoAddIssue;
  FIELDCOPY(m_sAddDistDateStart, one.m_sAddDistDateStart);
  FIELDCOPY(m_sAddDistDateEnd, one.m_sAddDistDateEnd);
  m_fAddIssueCommissionRate = one.m_fAddIssueCommissionRate;
  m_fAddIssuePrice = one.m_fAddIssuePrice;
  FIELDCOPY(m_sAnnStatus, one.m_sAnnStatus);
  FIELDCOPY(m_sFirstIssueKey, one.m_sFirstIssueKey);
  FIELDCOPY(m_sFirstIssueID, one.m_sFirstIssueID);
  FIELDCOPY(m_sBidOutcome, one.m_sBidOutcome);
  m_sReason = one.m_sReason;
}

CAdditionBondInfo::~CAdditionBondInfo() {}

void CAdditionBondInfo::Clear() {
  m_nNoAddIssue = 0;
  memset(m_sAddDistDateStart, 0, sizeof(m_sAddDistDateStart));
  memset(m_sAddDistDateEnd, 0, sizeof(m_sAddDistDateEnd));
  m_fAddIssueCommissionRate = 0;
  m_fAddIssuePrice = 0;
  memset(m_sAnnStatus, 0, sizeof(m_sAnnStatus));
  memset(m_sFirstIssueKey, 0, sizeof(m_sFirstIssueKey));
  memset(m_sFirstIssueID, 0, sizeof(m_sFirstIssueID));
  m_sReason = "";
}

void CAdditionBondInfo::SetNoAddIssue(int nNoAddIssue) {
  m_nNoAddIssue = nNoAddIssue;
}
void CAdditionBondInfo::SetAddDistDateStart(const char* AddDistDateStart) {
  memset(m_sAddDistDateStart, 0, sizeof(m_sAddDistDateStart));
  if (nullptr == AddDistDateStart) return;
  FIELDCOPY(m_sAddDistDateStart, AddDistDateStart);
}
void CAdditionBondInfo::SetAddDistDateEnd(const char* AddDistDateEnd) {
  memset(m_sAddDistDateEnd, 0, sizeof(m_sAddDistDateEnd));
  if (nullptr == AddDistDateEnd) return;
  FIELDCOPY(m_sAddDistDateEnd, AddDistDateEnd);
}
void CAdditionBondInfo::SetAddIssueCommissionRate(
    double fAddIssueCommissionRate) {
  m_fAddIssueCommissionRate = fAddIssueCommissionRate;
}
void CAdditionBondInfo::SetAddIssuePrice(double fAddIssuePrice) {
  m_fAddIssuePrice = fAddIssuePrice;
}
void CAdditionBondInfo::SetAnnStatus(const char* sAnnStatus) {
  memset(m_sAnnStatus, 0, sizeof(m_sAnnStatus));
  if (nullptr == sAnnStatus) return;
  FIELDCOPY(m_sAnnStatus, sAnnStatus);
}
void CAdditionBondInfo::SetFirstIssueKey(const char* sFirstIssueKey) {
  memset(m_sFirstIssueKey, 0, sizeof(m_sFirstIssueKey));
  if (nullptr == sFirstIssueKey) return;
  FIELDCOPY(m_sFirstIssueKey, sFirstIssueKey);
}
void CAdditionBondInfo::SetFirstIssueID(const char* sFirstIssueID) {
  memset(m_sFirstIssueID, 0, sizeof(m_sFirstIssueID));
  if (nullptr == sFirstIssueID) return;
  FIELDCOPY(m_sFirstIssueID, sFirstIssueID);
}
void CAdditionBondInfo::SetBidOutcome(const char* sBidOutcome) {
  memset(m_sBidOutcome, 0, sizeof(m_sBidOutcome));
  if (nullptr == sBidOutcome) return;
  FIELDCOPY(m_sBidOutcome, sBidOutcome);
}
void CAdditionBondInfo::SetReason(const char* sReason) {
  m_sReason = "";
  if (nullptr == sReason) return;
  m_sReason = sReason;
}
void CAdditionBondInfo::SetAutcionType(const char* sAutcionType) {
  memset(m_sAutcionType, 0, sizeof(m_sAutcionType));
  if (nullptr == sAutcionType) return;
  FIELDCOPY(m_sAutcionType, sAutcionType);
}
void CAdditionBondInfo::SetAuctionTimeStart(int nAuctionTimeStart) {
  m_nAuctionTimeStart = m_nAuctionTimeStart;
}
void CAdditionBondInfo::SetAuctionTimeEnd(int nAuctionTimeEnd) {
  m_nAuctionTimeEnd = nAuctionTimeEnd;
}

int CAdditionBondInfo::GetNoAddIssue() const { return m_nNoAddIssue; }
const char* CAdditionBondInfo::GetAddDistDateStart() {
  return m_sAddDistDateStart;
}
const char* CAdditionBondInfo::GetAddDistDateEnd() { return m_sAddDistDateEnd; }
double CAdditionBondInfo::GetAddIssueCommissionRate() {
  return m_fAddIssueCommissionRate;
}
double CAdditionBondInfo::GetAddIssuePrice() { return m_fAddIssuePrice; }
const char* CAdditionBondInfo::GetAnnStatus() { return m_sAnnStatus; }
const char* CAdditionBondInfo::GetFirstIssueKey() const {
  return m_sFirstIssueKey;
}
const char* CAdditionBondInfo::GetFirstIssueID() { return m_sFirstIssueID; }
const char* CAdditionBondInfo::GetBidOutcome() { return m_sBidOutcome; }
const char* CAdditionBondInfo::GetReason() { return m_sReason.c_str(); }
const char* CAdditionBondInfo::GetAutcionType() { return m_sAutcionType; }
int CAdditionBondInfo::GetAuctionTimeStart() { return m_nAuctionTimeStart; }
int CAdditionBondInfo::GetAuctionTimeEnd() { return m_nAuctionTimeEnd; }
